<template>
	<div class="uc-menu">
		<ul>
			<li>
				<router-link to="/">
					<i class="icon fa fa-home"></i>
					<span>網站首頁</span>
				</router-link>
			</li>
			<li>
				<router-link to="/uc/share">
					<el-badge is-dot :hidden="hideDabge"><i class="icon fa fa-magnet"></i></el-badge>
					<span>推廣關係</span>
				</router-link>
			</li>
			<li>
				<router-link to="/uc/authorize">
					<i class="icon fa fa-key"></i>
					<span>授權中心</span>
				</router-link>
			</li>
			<li v-if="isJudgeWhoAccessFunds">
				<router-link to="/uc/wallet_binding">
					<i class="icon el-icon-s-finance"></i>
					<span>綁定錢包</span>
				</router-link>
			</li>
			<li>
				<router-link to="/uc/CreateVote">
					<i class="icon fa fa-paper-plane"></i>
					<span>發起賽事</span>
				</router-link>
			</li>
			<li>
				<router-link to="/uc/MySponsored">
					<i class="icon fa fa-flag-checkered"></i>
					<span>我發起的賽事</span>
				</router-link>
			</li>
			<li>
				<router-link to="/uc/MyInvolved">
					<i class="icon fa fa-comments-o"></i>
					<span>我參與的投票</span>
				</router-link>
			</li>
			<!--這裡顯示這個太過於複雜，賽事大廳有就可以-->
			<!--<li>-->
			<!--	<router-link to="/uc/MyInvolvedGame">-->
			<!--        <el-badge><i class="icon fa fa-gamepad"></i></el-badge>-->
			<!--        <span>我參與的賽事</span>-->
			<!--    </router-link>-->
			<!--</li>-->
			<li v-if="isSuperUser">
				<router-link to="/uc/ContestCheck">
					<el-badge value="9999" type="danger"><i class="icon fa fa-check-circle-o"></i></el-badge>
					<span>賽事結果覆核</span>
				</router-link>
			</li>
			<li v-if="isSuperUser">
				<router-link to="/uc/ContestManage">
					<i class="icon fa fa-gear "></i>
					<span>賽事投票管理</span>
				</router-link>
			</li>
			<li v-if="isSuperUser">
				<a href="http://xgame.run/game1/xg_admin/manage/page/index.html">
					<i class="icon fa fa-gear "></i>
					<span>管理后台</span>
				</a>
			</li>
			<!--<li v-if="isJudgeWhoAccessFunds">
				<a href="/uc/spread">
					<el-badge>
						<i class="icon el-icon-s-order"></i>
					</el-badge>
					<span>推廣數據</span>
				</a>
			</li>-->

		</ul>

	</div>
</template>

<script>
import { mapGetters, mapState } from "vuex";
import { judgeWhoAccessFunds } from "@/axios/api";
import {mixins} from "@/mixins/mixins";
export default {
	name: "ucMenu",
	props:{

	},
	mixins:[mixins],
	data(){
		return {
			isJudgeWhoAccessFunds: false
		}
	},
	computed:{
		...mapState(['hideDabge','superUser']),
		...mapGetters(['isSuperUser']),
	},
	created () {
		this.judgeWhoAccessFunds();
	},
	methods: {
		//判断，用户资金数据权限。如果可以就显示推广数据，不然就v-if隐藏掉
		judgeWhoAccessFunds: function () {
			console.log('请求推广许可')
			let that = this;
			console.log(localStorage.getItem('sender'))
			judgeWhoAccessFunds({
				'act'        : 'judgeWhoAccessFunds',
				'userAddress': localStorage.getItem('sender')
			}).then(result => {
				console.log(result);
				that.isJudgeWhoAccessFunds = result.data;
			}).catch((error)=> {
			    console.log(error)
			})
		}
	},
	watch:{
		sender: {
			handler (nv, ov) {
				this.judgeWhoAccessFunds();
			},
			deep: false,
			immediate: false
		}

	}

}
</script>

<style>

</style>
